home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CreatingGames / Utilities / Basic / BlitzPlay / BlitzPlay.ascii < prev    next >
Encoding:
Text File  |  1992-09-02  |  3.6 KB  |  138 lines

  1.  
  2. ;*****************************************************************
  3. ;*
  4. ;*  BlitzPlay History
  5. ;*
  6. ;*  V0:   Initial release
  7. ;*
  8. ;*****************************************************************
  9.  
  10. NoCli       ;First up, get rid of that damned CLI
  11. WBStartup   ;Kickstart 2+ ONLY, which really sucks.  Does anyone have a 1.3 WBStartUp command?
  12. Goto begin  ;We don't want to run through the version info do we ;)
  13. Dc.b "$VER: BlitzPlay V0 1997 Toby Zuijdveld"
  14. Even        ;We don't want to accidentally set the code to 020 only now do we ;)
  15.  
  16. .begin:
  17.   INCLUDE "THX-Offsets.bb"
  18.   INCLUDE "BlitzPlay.bb"  ;In with the features
  19.   MaxLen fi$=64           ;The maximum length of the filename$ - I know they're too big but I'm too lazy
  20.   MaxLen pa$=160          ;The maximum length of the pathname$ - to get them as small as possible :)
  21.   FindScreen 0            ;We have to grab a screen from somewhere so we can open the filereq
  22.   DefaultIDCMP $200
  23.   Window 0,0,16,ScreenWidth,ScreenHeight-16,$100f,"",2,1
  24.   WindowOutput 0
  25.  
  26. .again:
  27.   title$="Select a module to play"  ;The loop
  28.   success$=Begin{FileRequest$(title$,pa$,fi$)}  ;OK it's not a very pretty filereq but it does the job and it's s
  29.   If success$<>""
  30.     body$=success$
  31.     Gosub doerror
  32.     Goto ende
  33.   EndIf
  34.   tempnumber.b=TimerModes{}
  35.   If tempnumber=4
  36.     body$="TimerTick speeds not supported in this player!"  ;AND TimerTick isn't supported by this player ;)
  37.     Gosub doerror
  38.     Goto ende
  39.   EndIf
  40.   If tempnumber>3 Then tempnumber-4
  41.   If tempnumber<>3  ;We expect there's at least one player routine, so we won't both
  42.     choice.b=tempnumber
  43.   Else
  44.     If NTSC
  45.       choice=2
  46.     Else
  47.       choice=1
  48.     EndIf
  49.   EndIf
  50.   success$=InitMusic{}  ;Initialise the module
  51.   If success$<>"" ;Did it work?
  52.     body$=success$  ;Nope, then error me purple.
  53.     Gosub doerror
  54.     Goto ende
  55.   EndIf
  56.   numsongs.b=GetNumSongs{}
  57.   tit$="BlitzPlay by Toby Zuijdveld"
  58.   currenttune.l=Rnd(numsongs)+1
  59.   SetSongNum{currenttune}
  60.   success$=StartMusic{}
  61.   If success$<>""
  62.     body$=success$
  63.     Gosub doerror
  64.     Goto ende
  65.   EndIf
  66.   leftnoise.l=$100
  67.   rightnoise.l=$100
  68.   songname$=GetSongName{}
  69.   songauthor$=GetSongAuthor{}
  70.   title$=""
  71.   If songauthor$<>"" Then title$=songname$+" Created by "+songauthor$
  72.   maker$=GetMakerName{}
  73.   If maker$="" Then maker$=CreatorID{}
  74.   If title$<>""
  75.     title$+" with "+maker$
  76.   Else
  77.     title$=songname$+" Created with "+maker$
  78.   EndIf
  79.   WTitle title$,tit$
  80.   scrolltxt$=GetScroll{}
  81.   NPrint ""
  82.   WPrintScroll
  83.   NPrint "This module contains ",numsongs," songs."
  84.   WPrintScroll
  85.   NPrint "We are playing song #",currenttune,"."
  86.   WPrintScroll
  87.   NPrint ""
  88.   WPrintScroll
  89.   Repeat  ;Wait for user to get sick of the MOD
  90.     ev.l=Event
  91.     VWait
  92.     If choice=1
  93.       success.b=Vblank50{}  ;Actually PLAYS the MOD :)
  94.     Else
  95.       success=Vblank60{}
  96.     EndIf
  97.     If scrolltxt$<>""
  98.       counter.b+1
  99.       If counter=5
  100.         WTitle scrolltxt$,title$
  101.         scrolltxt$=UnRight$(scrolltxt$,1)
  102.         If Len(scrolltxt$)=0 Then scrolltxt$="":WTitle title$,tit$
  103.         counter=0
  104.       EndIf
  105.     EndIf
  106.   Until ev=$200
  107.   For i.l=255 To 0 Step -1
  108.     VWait
  109.     If choice=1
  110.       success.b=Vblank50{}  ;Actually PLAYS the MOD :)
  111.     Else
  112.       success=Vblank60{}
  113.     EndIf
  114.     success=SetVolume{i,i}
  115.   Next
  116.   StopMusic{}
  117.   EndMusic{}
  118.   Finish{}  ;We better add that in, before I lose all my memory testing this code :)
  119. Goto again  ;That's it, Charlie Brown!
  120.  
  121. .ende:
  122.   CloseWindow 0
  123.   Free Screen 0
  124. End
  125.  
  126. .doerror: ;My really groovey error handler...
  127.   NPrint ""
  128.   WPrintScroll
  129.   NPrint body$
  130.   WPrintScroll
  131.   NPrint ""
  132.   WPrintScroll
  133.   NPrint "Hit mousebutton to continue."
  134.   WPrintScroll
  135.   MouseWait
  136. Return  ;And that's it :)
  137.  
  138.